package com.quirka.logica.filtro;

import java.awt.image.BufferedImage;


public class FiltroImagen
{
   
    /***************************************************************************
    DOCUMENT ME!

    @param   imageOld  DOCUMENT ME!
    @param   f         DOCUMENT ME!

    @return  DOCUMENT ME!
    ***************************************************************************/
    public static BufferedImage filtrar(BufferedImage imageOld, Filtro f)
    {
        BufferedImage imagenew = imageOld.getSubimage(0, 0, imageOld.getWidth(),
                imageOld.getHeight());    
        
        int n = imageOld.getWidth();
        int m = imageOld.getHeight();

        for (int fila = f.getRangoFin(); fila < (n - f.getRangoFin()); fila++)
        {
            for (int col = f.getRangoFin(); col < (m - f.getRangoFin()); col++)
            {
                f.calcular(imagenew, imageOld, fila, col);
            }
        }

        return imagenew;
    }
    


}
